 #include <windows.h> 
 #include <stdio.h>

 BOOL g_trace;

 /*
  * single point logger function
  */

 void
  logit_a (const char *str, ...)
 {
   char trace[2048];
   va_list args;

   if (g_trace) {
     trace[0] = '\0';
     va_start(args, str);
	 #ifdef __WXMSW__
	  vsprintf_s(trace, str, args);
      OutputDebugStringA(trace);
	 #else
	  vsprintf(trace, str, args);
	 #endif
     va_end(args);
   }
 }

 void
  logit_w (const wchar_t *str, ...)
 {
   wchar_t trace[2048];
   va_list args;

   if (g_trace) {
     trace[0] = L'\0';
     va_start(args, str);

     #ifdef __WXMSW__
       vswprintf(trace, 2048, str, args);
       OutputDebugStringW(trace);
     #else
       vswprintf(trace, str, args);
     #endif

     va_end(args);
   }
 }
 
 
 static inline bool is_base64(unsigned char c) {
  return (isalnum(c) || (c == '+') || (c == '/'));
}
